<?= $this->outputMessages1() ?>
<?= $this->outputErrors1() ?>

<div id="formwrap">
<?= kvframework_markup::form_remote_tag(array("update" => 'main_div', "url" => self::url_for('ophour_admin', 'process_form'))) ?>
<table cellspacing="0">
<tbody>
  <tr align="left" valign="center">
    <td class="title" colspan="2"><div class="titler" style="float:left;">Changing Operating Hours</div><div style="float:right"><?= kvframework_markup::link_to_remote("cancel", array("update" => 'main_div', "url" => self::url_for('admin', 'index'), "loading" => 'doLoading(\'main\')')) ?></div></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Type of Change:</th>
    <td><?= kvframework_markup::select(array("name" => "form[special]", "values" => array(array("Open Hours", "regular"),array("Closed Hours", "delete")), "prompt" => true, "selected" => ((array_key_exists("form", self::$PARAMS) && is_array(self::$PARAMS["form"]) && array_key_exists("special", self::$PARAMS["form"])) ? self::$PARAMS["form"]["special"] : null), "class" => 'txtbox2')) ?></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Semester:</th>
    <td><?= kvframework_markup::select(array("name" => "form[semester]", "values" => $this->all_sems, "prompt" => true, "selected" => ((array_key_exists("form", self::$PARAMS) && is_array(self::$PARAMS["form"]) && array_key_exists("semester", self::$PARAMS["form"])) ? self::$PARAMS["form"]["semester"] : null), "class" => 'txtbox2')) ?></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <td colspan="2">-or-</td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Start Date:<br />End Date:</th>
    <td>
    <input type="text" class="txtbox2" name="date[startdate]" id="date[startdate]" value="<?= (array_key_exists("date", self::$PARAMS) && is_array(self::$PARAMS["date"]) && array_key_exists("startdate", self::$PARAMS["date"])) ? self::$PARAMS["date"]["startdate"] : "" ?>" /><br />
    <input type="text" class="txtbox2" name="date[stopdate]" id="date[stopdate]" value="<?= (array_key_exists("date", self::$PARAMS) && is_array(self::$PARAMS["date"]) && array_key_exists("stopdate", self::$PARAMS["date"])) ? self::$PARAMS["date"]["stopdate"] : "" ?>" />
    </td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Start Time:</th>
    <td><?= TOOLS::mytime_select(array("selected" => ((array_key_exists("starttime", self::$PARAMS) && is_array(self::$PARAMS["starttime"])) ? TOOLS::string_to_time(implode(":", self::$PARAMS["starttime"])) : null), "name" => "starttime", "on_minutes" => 30, "display12h" => true, "include_59" => false)) ?></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Stop Time:</th>
    <td><?= TOOLS::mytime_select(array("selected" => ((array_key_exists("stoptime", self::$PARAMS) && is_array(self::$PARAMS["stoptime"])) ? TOOLS::string_to_time(implode(":", self::$PARAMS["stoptime"])) : null), "name" => "stoptime", "on_minutes" => 30, "display12h" => true, "include_59" => true)) ?></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>Weekdays:</th>
    <td><?= kvframework_markup::select(array("name" => "repetition[]", "values" => array(array("Monday", "M"),array("Tuesday", "T"),array("Wednesday", "W"),array("Thursday", "H"),array("Friday", "F"),array("Saturday", "S"),array("Sunday","N")), "selected" => ((array_key_exists("repetition", self::$PARAMS) && is_array(self::$PARAMS["repetition"])) ? self::$PARAMS["repetition"] : array("M","T","W","H","F","S","N")), "class" => 'txtbox2', "size" => 7, "multiple" => 'multiple')) ?></td>
  </tr>
  <tr>
    <td colspan="2" class="spacer"></td>
  </tr>
  <tr align="left" valign="top">
    <th>&nbsp;</th>
    <td><input type="submit" value="save this data" class="txtbox3" /></td>
  </tr>
</tbody>
</table>
</form>
</div>
